<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Liên hệ hỗ trợ</title>
<link rel="stylesheet" type="text/css" href="style/stylelogin.css">
<!--script src="http://h2.flashvortex.com/display.php?id=2_1365392788_20938_221_0_41_63_6_2_1" type="text/javascript"></script-->
<script type="text/javascript" src="js/jquery-1.6.4.js"></script>
<script type="text/javascript" src="js/contactjs.js"></script> 
<script type="text/javascript" src="js/jquery-validation-1.9.0/jquery.validate.min.js"></script>  

<script type="text/javascript" src="js/validate.js"></script>
</head>
</head>

<body background="img/1143764764.gif">
<?php
 
if(isset($_POST['smcontact'])) {
  $from = $_POST['maily']; // lay trong form
  $to = "dream.is.dream.91@gmail.com"	; // dia chi mail cua admin, co the lay tu csdl
  $subject = "Tôi là:".$_POST['name']."địa chỉ của tôi là:".$_POST['addr']; // lay ra ten nguoi gui va chu de gui
  $message = $_POST['ykien']; //noi dung thu
  //thiet lap SMTP Server	
	 //Nhúng thư viện phpmailer
	 
	 include "phpmailer/class.phpmailer.php"; 
     include "phpmailer/class.smtp.php";
	$mail = new PHPMailer(); // khoi tao doi tuong
$mail->IsSMTP(); // goi class smtp de dang nhap
$mail->CharSet = "utf-8"; // bang ma unicode
$mail->Host = "smtp.gmail.com"; // dia chi server smtp
$mail->Port = 465; // cong smtp
// dang nhap smtp
$mail->SMTPAuth = true; // gui thong tin dang nhap
$mail->SMTPSecure = 'ssl'; // giao thuc ssl
$mail->Username = "loppb1211l@gmail.com"; // ten dang nhap gmail
$mail->Password = "thanglongaptech"; // mat khau gmail tren

$to="dream.is.dream.91@gmail.com"; // mail nhan thu
$name="Xoan Nguyen"; // ten nguoi nhan thu
$mail->From = $from;
$mail->FromName = $_POST['name']; // ten nguoi gui
$mail->AddAddress($to,$name); // them mail nguoi nhan
$mail->AddReplyTo($from,"Xoan Nguyen");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML

$mail->Subject = $subject;// tieu de thu
$mail->Body = $message; // noi dung thu
$mail->AltBody = $message;
/*
de gui mail dc tu localhost :
1. sua file php.ini nhu sau:
bo dau ";" truoc 3 vi tri 
extension=php_openssl.dll
SMTP = localhost
smtp_port = 25
2. may tinh phai duoc ket noi mang internet
*/


	 
	 ////////////////
 
  
	if($_POST['capcha'] == NULL) {
		
		echo "<script>
		   alert('nhap ma capcha');
		</script>";
	}
	else {
		if($_SESSION['security_code'] == $_POST['capcha']&&($mail->Send())) {
			
			       echo "<script>
		           alert('Nhap xong thong tin lien he, cho phan hoi');
		           </script>";
				   // thao tac gui mail
			
			}
		else {
			
			     echo "<script>
		           alert('nhap ma lai cho dung, or mail chua duoc gui');
		           </script>";
			
			}
		
		
	}
	
	
}
?>
<div id="lh">
<div id="hotro">
<div id="ql">
 <h2>Click me ******<br/> Did you login? and ...</h2>
</div>
<ul id="dm">
      
        
            <li>Tạo album ảnh riêng</li>
            <li>Bình luận,chia sẻ ảnh</li>
            <li>Chọn để tải ảnh về máy</li>
</ul>

</div>
<div id="contact">
<!--khac nhap giua dang nhap va chua dang nhap, sau day la dung cho khach vang lai-->
<form name="contactform" method="post" action="" class="signin" id="contact_form">
<fieldset class="textbox">
                <label class="Name">
                <span>Name</span>
                <input id="name" name="name"  type="text" class="required">
                </label>
                <label class="address">
                <span>Adress</span>
                <input id="addr" name="addr"  type="text" class="required">
                </label>
                 <label class="Name">
                <span>Email</span>
                <input id="maily" name="maily" type="text" class="required email">
                </label>
               
                 <label class="Name">
                <span>Ý kiến</span>
               <textarea cols="30" rows="10" class="required" name="ykien"></textarea>
                </label>
                 <span>Mã capcha</span>
                 <label class="macc">
                 <input type = "text" name = "capcha" size = "5"> 
                <img src = "random_img.php">
                </label>
                <input type="submit" name="smcontact" value="Sent" class="subm">
</fieldset>
</form>
</div>
<div id="home">
<embed src="flash/flashvortex.swf" quality="best" menu="true" width="51" height="63" type="application/x-shockwave-flash" />

</div>
</div>

<div id="style_bg"> Change background!!
    <ul>
      
        <li><img src="img/bgmain2.jpg"  	alt="example"/></li>
        
        <li><img src="img/bgmain3.jpg"  	alt="example"/></li>
       
        <li><img src="img/bgmain4.jpg"  	alt="example"/></li>
       
        <li><img src="img/bgmain6.jpg"  	alt="example"/></li>
        <li><img src="img/bgmain7.jpg"  	alt="example"/></li>
      
        <li><img src="img/bgmain9.jpg"  	alt="example"/></li>
       
         
    </ul>
</div>




</body>
</html>